<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['base_path']?>public/css/style.css" media="screen" />
        <link rel="shortcut_icon" href="<?php echo $GLOBALS['base_path']?>public/img/icon.ico" />
        <link rel="icon" href="<?php echo $GLOBALS['base_path']?>public/img/icon.png" />
        <title>Foto</title>
        <script type="text/javascript" src="<?php echo $GLOBALS['base_path']?>public/js/fquery.js"></script>
        <script type="text/javascript" >
                var validator = {
                    'photoFile' : {
                            'regex' : /^.*\.(bmp|jpeg|jpg|gif|png)$/,
                            'message' : 'Tipe gambar: bmp|jpeg|jpg|gif|png'
                    }
                }
                function init() {
                    calendar("datepicker","date");
                    validate("photoUploadForm" , validator);
                }

        </script>
    </head>
    <body onload="init()">
        <div id="bodyWrapper">
            <?php $this->render('accountbar');?>
            <div class="dummy"></div>
            <?php $this->render('menubar');?>

            <div id="content">
                <h2>Foto saya</h2>
                <div id="photoAlbumList">
                    <?php foreach($photos as $photo) : ?>
                    <div class="photoThumbnail">
                        <a href="<?php echo $this->createUrl('photo/detail/' . $photo->id)?>">
                            <img src="<?php echo $GLOBALS['base_path'] . PhotoModel::$UPLOAD_DIR . $photo->name?>" alt="" />
                        </a>
                        <br />
                        <a href="<?php echo $this->createUrl('photo/delete/' . $photo->id)?>">Hapus</a>
                        <?php if ($photo->id != $this->auth->photo_id) : ?>
                            <a href="<?php echo $this->createUrl('photo/setprofile/' . $photo->id)?>">Foto profil</a>
                        <?php endif;?>
                    </div>
                    <?php endforeach;?>
                </div>
                <div class="dummy"></div>
                <h2>Unggah Foto</h2>
                <form id="photoUploadForm" method="post" action="<?php echo $this->createUrl('photo/upload')?>" enctype="multipart/form-data">
                    <div class="dtable">
                        <div class="drow">
                            <span class="shead"><label for="description">Dekripsi</label></span>
                            <span>
                                <textarea name="description" id="description" rows="5" cols="30"></textarea>
                            </span>
                        </div>
                        <div class="drow">
                            <span class="shead"><label for="keyword">Kata kunci</label></span>
                            <span><input type="text" id="keyword" name="keyword" /></span>
                        </div>
                        <div class="drow">
                            <span class="shead"><label for="category">Kategori</label></span>
                            <span><input type="text" id="category" name="category" /></span>
                        </div>
                        <div class="drow">
                            <span class="shead"><label for="access_rule">Hak Akses</label></span>
                            <span>
                                <input type="radio" name="access_rule" id="access_rule" value="<?php echo PhotoModel::$ACCESS_EVERY?>" checked="true" /> Bebas<br />
                                <input type="radio" name="access_rule" id="access_rule" value="<?php echo PhotoModel::$ACCESS_LOGIN?>" /> Pengguna saja<br />
                                <input type="radio" name="access_rule" id="access_rule" value="<?php echo PhotoModel::$ACCESS_FOLLOWER?>" /> Pengikut saja<br />
                                <input type="radio" name="access_rule" id="access_rule" value="<?php echo PhotoModel::$ACCESS_PRIVATE?>" /> Pribadi<br />
                            </span>
                        </div>
                        <div class="drow">
                            <span class="shead"><label for="comment_rule">Hak Komentar</label></span>
                            <span>
                                <input type="checkbox" name="comment_rule" />
                            </span>
                        </div>
                        <div class="drow">
                            <span class="shead"><label for="date">Tanggal</label></span>
                            <span>
                                <input type="text" id="date" name="date" />
                                <a href="#"><img onclick="toggleCalendar(this);return false;" class="dp-choose-date" alt="date" src="<?php echo $GLOBALS['base_path']?>public/img/calendar.png" title="Pilih Tanggal" /></a>
                                <span class="dummy"></span>
                            </span>
                        </div>
                        <div class="drow">
                            <span class="shead"><label for="photoFile">File</label></span>
                            <span>
                                <input type="file" id="photoFile" name="photoFile" />
                            </span>
                        </div>
                        <div class="drow">
                            <span class="shead"><input type="submit" value="Unggah" /></span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div id="datepicker"></div>
        <script src="<?php echo $GLOBALS['base_path']?>public/js/calendar.js" type="text/javascript"></script>
    </body>
</html>